﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ColorPatterns
{
    public class AnimationFactory
    {
        public static Storyboard CreateColorDownUpAnimation(Shape shape)
        {
            Storyboard storyboard = new Storyboard();

            DoubleAnimation opacityAnimation = new DoubleAnimation();
            opacityAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.3));
            opacityAnimation.AutoReverse = true;
            opacityAnimation.From = 1;
            opacityAnimation.To = 0.75;
            Storyboard.SetTarget(opacityAnimation, shape);
            Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath("Opacity"));
            storyboard.Children.Add(opacityAnimation);

            return storyboard;
        }

        public static Storyboard CreateColorTransitionAnimation(Shape shape)
        {
            Storyboard storyboard = new Storyboard();

            DoubleAnimation opacityAnimation = new DoubleAnimation();
            opacityAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.2));
            opacityAnimation.From = 1;
            opacityAnimation.To = 0.75;
            Storyboard.SetTarget(opacityAnimation, shape);
            Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath("Opacity"));
            storyboard.Children.Add(opacityAnimation);
            
            return storyboard;
        }


    }
}
